package com.agricultural.command.impl;

import com.agricultural.command.Command;
import com.agricultural.equipment.AgriculturalEquipment;

// 执行作业命令
public class ExecuteWorkCommand implements Command {
    private AgriculturalEquipment equipment; // 设备引用
    
    // 构造函数
    public ExecuteWorkCommand(AgriculturalEquipment equipment) {
        this.equipment = equipment;
    }
    
    // 执行命令
    @Override
    public void execute() {
        System.out.println("执行作业命令: " + equipment.getType() + "-" + equipment.getId());
        equipment.executeWork();
    }
    
    // 撤销命令 - 此处简化处理，仅停止设备
    @Override
    public void undo() {
        System.out.println("撤销作业命令: " + equipment.getType() + "-" + equipment.getId());
        equipment.stop();
    }
}    